% 这是nwafu(西北农林科技大学)Flux扁平主题的外部主题.
% 版权(c) 2015-2019, 信息工程学院 耿楠<nangeng@nwafu.edu.cn>
%
% 本主题修改于主题：https://github.com/pvanberg/flux-beamer
%
% 这是一个免费代码：发布和修改该代码，请遵守最新版的自由软件联盟发布
% 的GNU通用公共协议
%
% 期望这一代码对你有用，但值得注意的是，我不对任何后续问题进行维护，
% 请参考<http://www.gnu.org/licenses/>查看最新的协议内容。

\mode<presentation>

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 声明: hbox中的“％”符号在这里都非常重要。只要有空白，\hbox环境就会插入空格。
% 在每行结尾添加％可确保任何硬回车符都不会解释为空白，这允许颜色框与另一个齐平。
% 如果出现细小的白线，可能需要添加hspace{-1px}以产生额外的1个或2个像素宽的beamercolorbox。
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 页眉
\setbeamertemplate{frametitle}
{
    \nointerlineskip
    \begin{beamercolorbox}[wd=\paperwidth,leftskip=0.2cm,ht=0.6cm,dp=0.25cm]{header primary}%
        \usebeamerfont{header title}\insertframetitle% \ | \ 
        \ifx\insertframesubtitle\@empty%
        \else
          \ |\ %
          \usebeamercolor*[fg]{header title}\usebeamerfont{header subtitle}\insertframesubtitle%
        \fi%
        %{\usebeamercolor*[fg]{header title}\usebeamerfont{header subtitle}\insertframesubtitle}
        \hfill
    \begin{beamercolorbox}[wd=0.21\paperwidth,ht=0.6cm,dp=0.25cm]{header primary}%
    	% 垂直对齐Logo
    	\vspace*{-0.13cm}
    	\includegraphics[width=0.19\paperwidth, keepaspectratio]{nwafulogo/nwafu-logo-bar-h-wb-bg}\hfill
    \end{beamercolorbox}%
    \end{beamercolorbox}%
    \nointerlineskip
    % 页眉阴影
    \pgfdeclareverticalshading{beamer@topshade}{\paperwidth}{%
    color(3pt)=(primaryLight!0);
    color(4pt)=(primaryLight)}
    \begin{beamercolorbox}[wd=\paperwidth, center]{}%
		    \pgfuseshading{beamer@topshade}
    \end{beamercolorbox}%
}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 页脚
\setbeamertemplate{footline}
{%
  \begin{beamercolorbox}[wd=\textwidth, center]{footer}%
    \rule{0.95\paperwidth}{0.2pt}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=\textwidth, leftskip=0.3cm,rightskip=0.3cm, ht=0.3cm,dp=0.15cm]{footer text}%
    \usebeamerfont{footnote}\copyright \ \insertauthor\hfill
    \insertshorttitle{}
    % Uncomment to display navigation button
    %\insertslidenavigationsymbol%
    %\insertframenavigationsymbol%
    %\insertsubsectionnavigationsymbol%
    %\insertsectionnavigationsymbol%
    %\insertdocnavigationsymbol%
    %\insertbackfindforwardnavigationsymbol%	
    \hfill\insertshortinstitute{}\ \insertframenumber/\inserttotalframenumber{}%
  \end{beamercolorbox}%
}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 个性化脚注
\hfuzz=\maxdimen % 消除hbox overfull警告(TODO) 
\renewcommand\footnoterule{\color{Gray!50}\hspace*{-0.5cm}\rule{0.95\paperwidth}{0.2pt}\vspace*{0.07cm}}
\setbeamertemplate{footnote}{%
  \begin{beamercolorbox}[wd=\textwidth, leftskip=0.3cm,rightskip=0.3cm]{footer text}%
    \usebeamerfont{footnote}\insertfootnotemark\insertfootnotetext%
  \end{beamercolorbox}%
}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% 标题页
\def\titlepage{\usebeamertemplate{title page}}
\def\logo@width{0.15\paperwidth}
\def\logo@height{0.11\paperheight}
\tikzset{
  sider/.style={
    draw=none,
    rectangle,
    outer xsep=-0.1mm,
    minimum height=\paperheight,
    minimum width=0.8cm,
    fill=primaryLight
  },
  icon/.style={
    draw=none,
    fill=primaryLight!95, 
    minimum height=\logo@height,
    minimum width=\logo@width,
    text=background,
    outer xsep=0.4cm,
    outer ysep=0.4cm,
    inner sep=0.3cm,
    %rounded corners=\logo@height/2
  }
}
\setbeamertemplate{title page}
{
  \begin{frame}[plain]
    \begin{tikzpicture}[remember picture,overlay]
      \hspace*{-1pt}\node[anchor=west,sider] at (current page.west){};
      \node[anchor=south west,sider, fill=primary, minimum height=0.3\paperheight] at (current page.south west){};
      \node[align=center] at (current page.center){
        \usebeamerfont{title}\color{primary}\inserttitle\\[0.3cm]
        \usebeamerfont{subtitle}\color{Gray!90!black}\insertsubtitle\\[0.1cm]
        \usebeamercolor[fg]{footer}\rule{0.7\paperwidth}{0.2pt}	\\[0.35cm]
        \usebeamerfont{author}\color{Gray}\insertauthor\\[0.25cm]
        \usebeamerfont{institute}\color{Gray}\insertinstitute%
      };
      \node[anchor=south, outer ysep=1.6cm, opacity=0.55] at (current page.south){
        \includegraphics[scale=0.20]{nwafulogo/nwafu-bar-h-bw}
      };
      \node[align=center, anchor=south, outer ysep=0.2cm] at (current page.south){
        \small\color{Gray!90}中国$\boldsymbol{\cdot}$杨凌\\[-0.1cm]%
        \small\color{Gray!90}\insertdate
      };
      %\node[anchor=south east,icon] at (current page.south east)(logo){\includegraphics[width=\logo@width, height=\logo@height, keepaspectratio]{nwafulogo/nwafu-bar-h-bw}};
    \end{tikzpicture}
  \end{frame}
}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% TOC frame on new section
\AtBeginSection[]
{
\setbeamertemplate{section in toc}{
  \hspace*{0.4cm}\tikz[baseline=-0.5ex]\node[section number]{\usebeamerfont*{toc subtitle}\textbf{\inserttocsectionnumber}};
  \ \ \tikz[baseline=-0.5ex]\node[section]{\normalsize \textbf{\inserttocsection}};\\[-0.3cm]
  \hspace*{1.24cm}{\usebeamercolor*[fg]{footer} \rule{0.6\paperwidth}{0.2pt}\\\nointerlineskip}
}
 \setbeamertemplate{subsection in toc}{
  \hspace*{0.55cm}\tikz[baseline=-0.5ex]\node[subsection number, fill=secondary!80]{};
  \hspace*{0.5cm} \tikz[baseline=-0.5ex]\node[subsection]{\normalsize\inserttocsubsection};\\[-0.2cm]
}
 % Uncomment here to activate new page with section.
 %\begin{frame}{\hspace{0.5cm}}
 %	\tableofcontents[currentsection]
 %\end{frame}
}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

\mode<all>

